﻿<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:MicroBlogClient" xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" x:Class="MicroBlogClient.LoginWindow"
        AllowsTransparency="True" ShowInTaskbar="True" WindowStartupLocation="CenterScreen"
        WindowStyle="None" Background="{x:Null}" Icon="/Resources/logo.ico" Title="{StaticResource AppTitle}"
        xmlns:controls="clr-namespace:Rabbit.Controls;assembly=Rabbit.Controls" FontFamily="Microsoft YaHei,Sim Sun"
        ResizeMode="NoResize" Opacity="0.95" Height="202" Topmost="{Binding ElementName=chkNewUser, Path=IsChecked}"
        Width="330">
    <Border Style="{DynamicResource LoginWindowBorder}" CornerRadius="5">
        <Border.Effect>
            <DropShadowEffect Opacity="0.45" BlurRadius="9"/>
        </Border.Effect>
        <Border CornerRadius="5" BorderThickness="1">
            <!--main content starts from here-->
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="122"/>
                    <RowDefinition Height="30"/>
                </Grid.RowDefinitions>
                <Canvas Height="16" Grid.Row="0" VerticalAlignment="Top" Opacity="0.5" Background="{StaticResource WindowTitleBackground}" />
                <Canvas Height="32" Grid.Row="0" Background="{DynamicResource TitleBarLeftCornerHighlight}"/>
                <Border BorderBrush="{DynamicResource WindowTitleBarInnerBorder}" CornerRadius="5,5,0,0" Margin="0" BorderThickness="1,1,0,0">
                    <ContentControl PreviewMouseLeftButtonDown="Window_PreviewMouseDown">
                        <Canvas Height="32" Grid.Row="0" Margin="5,3,5,0" Background="{StaticResource WindowBackgroundBrush}">
                            <Image Height="16" Width="16" Source="/Resources/logo16.png"/>
                            <TextBlock Text="{StaticResource AppTitle}" Canvas.Left="22" Style="{DynamicResource AppTitleStyle}"/>
                            <StackPanel Orientation="Horizontal" Canvas.Right="0">
                                <Button Style="{DynamicResource WindowTitleBarButtonStyle}" ToolTip="最小化"  Click="btnTitleBarMin_Click">
                                    <Button.Content>
                                        <controls:ImageEx Source="{DynamicResource MinButton}" Width="14" Height="12"/>
                                    </Button.Content>
                                </Button>
                                <Button Style="{DynamicResource WindowTitleBarButtonStyle}" ToolTip="关闭"  Click="btnTitleBarClose_Click">
                                    <Button.Content>
                                        <controls:ImageEx Source="{DynamicResource CloseButton}" Width="14" Height="12"/>
                                    </Button.Content>
                                </Button>
                            </StackPanel>
                        </Canvas>
                    </ContentControl>
                </Border>
                <Border Grid.Row="1" CornerRadius="3" Background="White">
               
                        <Canvas Margin="5,20,0,5">
                            <Label Content="{Binding strUserLableText}" x:Name="tbInputTip" Width="45"  HorizontalAlignment="Center" Canvas.Left="10" VerticalAlignment="Bottom">
                                <Label.Style>
                                    <Style TargetType="Label">
                                        <Style.Triggers>
                                            <Trigger Property="Content" Value="验证码">
                                                <Setter Property="Foreground" Value="Red"/>
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Label.Style>
                            </Label>
                            <Border CornerRadius="3" Height="25"  BorderThickness="0" Canvas.Left="60" Width="149">
                                <ComboBox TextSearch.TextPath="UserName" ItemsSource="{Binding}" SelectedIndex="0" IsEditable="False" Background="White" SelectedValuePath="UserID" x:Name="cmbUserList" BorderBrush="{DynamicResource UserListComboBoxBorderBrush}" HorizontalAlignment="Left" Width="147">
                                    <ComboBox.ItemTemplate>
                                        <DataTemplate>
                                        <Grid Width="147" Height="25" VerticalAlignment="Center"> 
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="*" />
                                                    <ColumnDefinition Width="25" />
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0" VerticalAlignment="Center" Text="{Binding UserName}" />
                                                <Button Style="{DynamicResource DeleteUserButtonStyle}"  Width="14" Height="12" Grid.Column="1" x:Name="btnDeleteMe" Click="btnDeleteMe_Click"  CommandParameter="{Binding UserID}"/>
                                            </Grid>
                                        </DataTemplate>
                                    </ComboBox.ItemTemplate>
                                </ComboBox>
                            </Border>
                            <CheckBox Content="记住我" x:Name="chkRememberme" Canvas.Top="5" Canvas.Left="215" IsChecked="True" />
                            <TextBox Canvas.Top="0" Canvas.Left="60"
                                     Background="White"
                                     BorderBrush="Gray"
                                     BorderThickness="1"
                                    Visibility="{Binding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=chkNewUser}" 
                                     Width="150" 
                                     Height="25"  
                                     x:Name="txtVerifyCode" 
                                    />
                            <Button Style="{DynamicResource LoginButtonStyle}" Canvas.Top="30" Canvas.Left="55"  x:Name="btnLogin" Click="btnLogin_Click"/>
                            <!--<Button Canvas.Top="30" Canvas.Left="125"  Height="Auto" Width="Auto" x:Name="btnShowTip" Click="btnShowTip_Click" >
                                Win7
                            </Button>
                            <Button Canvas.Top="30" Canvas.Left="165"  Height="Auto" Width="Auto" x:Name="btnBlue" Click="btnBlue_Click" >
                                fresh
                            </Button>-->
                        </Canvas> 
                </Border>
                <CheckBox  Grid.Row="2" Click="chkNewUser_Click" Foreground="{DynamicResource GrayColorBrush}" HorizontalAlignment="Right" x:Name="chkNewUser" Content="没有我的账号？" VerticalAlignment="Center"/>

                <Popup x:Name="popupUserTips" Placement="Bottom" PlacementTarget="{Binding ElementName=chkNewUser}"
                         AllowsTransparency="True"
                        StaysOpen="False" 
                        PopupAnimation="Slide">
                    <StackPanel Orientation="Horizontal"  Height="57" Width="201" Background="{DynamicResource LoginUserTipBackground}">
                    	<Canvas  Margin="10">
                            <TextBlock TextWrapping="Wrap" Width="190" Padding="1"  Foreground="Red" Background="{x:Null}">
                            	<ContentControl Content="{DynamicResource ProcessingMessageIcon}" x:Name="contentProcessingImage"/>在稍后打开的网页中，得到验证码之后输入到文本框中
                                <!--<Hyperlink x:Name="linkOpenImmediately" Click="linkOpenImmediately_Click">立刻打开</Hyperlink>-->
                            </TextBlock>
							</Canvas>
                    </StackPanel>
                </Popup>
            </Grid>
        </Border>
    </Border>
</Window>
